import instance from './http'

export interface Danmaku {
  id: string
  message: string
}

// 获取弹幕列表
export const getDanmaku = async (): Promise<Danmaku[]> => {
  const response = await instance.get('/danmuku')
  // API 返回的是空对象 {}, 我们返回空数组
  return []
}

// 添加弹幕
export const addDanmaku = async (message: string): Promise<Danmaku> => {
  const response = await instance.post('/danmuku', null, {
    params: { message }
  })
  // API 返回空对象, 我们生成一个临时 ID
  return {
    id: Date.now().toString(),
    message
  }
}

// 删除弹幕
export const deleteDanmaku = async (id: string): Promise<void> => {
  await instance.delete('/danmuku', {
    params: { id }
  })
}


